// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Vuex from 'vuex'
import store from '@/store'
Vue.use(Vuex)
import App from './App'
import router from './router'
import axios from './api/index';
import imageView from '@/assets/js/preview.js';
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/public.css'

Vue.config.productionTip = false

// rem适配
const setHtmlFontSize = () => {
    const htmlDom = document.getElementsByTagName('html')[0];
    let htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
    if (htmlWidth >= 1920) {
        htmlWidth = 1920;
    }
    if (htmlWidth <= 1366) {
        htmlWidth = 1366;
    }
    htmlDom.style.fontSize = `${htmlWidth / 19.20}px`;
};
window.onresize = setHtmlFontSize;
setHtmlFontSize();

Vue.prototype.axios = axios;
Vue.prototype.$imageView  =  imageView;
Vue.use(ElementUI);

/* eslint-disable no-new */
new Vue({
    el: '#app',
    store,
    router,
    components: { App },
    template: '<App/>'
})